﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="BaseData_SelectServiceStation" Codebehind="SelectServiceStation.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>

    <script type="text/javascript" src="../Include/JS/Address.js"></script>

    <script type="text/javascript" src="../Include/JS/Lib/jquery-1.1.4.js"></script>

    

    <script type="text/javascript">
        var  $j = jQuery.noConflict();
        function returnf()
         {
              var temp=document.getElementsByName("radio"); 
              var strvalue="";
              for (i=0;i<temp.length;i++)
              { 
               if(temp[i].checked==true) 
                  {
                  strvalue=temp[i].value; 

                 }
             
                }
             window.returnValue = strvalue;
            window.close();
            
         }
        function GetAreaListAndCountTotal(value,selectvalue)
        {   
            LoadArea=false;
            if(parseInt(value)>-1)
            {
                $j.post("../Handler/AddressHandler.ashx", {City:value, OP:"Area"},
                        function(data){                          
                           InitArea(data,selectvalue);
                        }
                    );
             }
             else
             {
                var sel = document.getElementById("Area"); 
            
                while( sel.length>0 )
                {
                    sel.removeChild(sel.options(0));
                    
                }
                sel.options[0]=new Option("请选择","-1");
             }
             var hidCity = document.getElementById("hidCity");
             hidCity.value=value;
             if(value!="-1")
             {
                document.getElementById("hidCityCode").value = value;
             }
             else
             {
                document.getElementById("hidCityCode").value = "000001";
             }
             
             
        }
        function SetAreaCode()
        {
            var dropArea = document.getElementById("Area");
            if(dropArea.options[0].selected)
            {
                document.getElementById("hidAreaCode").value = "000001";
                return;
            }
            for(var i=0;i<dropArea.options.length;i++)
            {
                if(dropArea.options[i].selected)
                {
                    document.getElementById("hidAreaCode").value = dropArea.options[i].value;
                    break;
                }
            }
        }
        
        function InitAddress()
        {
            var hidReceiveAddressInfo = document.getElementById("hidReceiveAddressInfo");
            var addressInfo = hidReceiveAddressInfo.value.split('$');
            var dropProvince = document.getElementById("Province");
            var dropCity = document.getElementById("City");
            var dropArea = document.getElementById("Area");
                        
            for(var i=0;i<dropProvince.options.length;i++)
            {
                if(dropProvince.options[i].value==addressInfo[0])
                {
                    dropProvince.options[i].selected = true;
                    break;
                }
            }
            if(addressInfo.length>1)
            {
                if(addressInfo[1]!="")
                {
                    GetCityList(addressInfo[0],addressInfo[1]);
                    document.getElementById("hidCityCode").value = addressInfo[1];
                }
            }
            if(addressInfo.length>2)
            {
                if(addressInfo[2]!="")
                {
                    GetAreaList(addressInfo[1],addressInfo[2]); 
                    document.getElementById("hidAreaCode").value = addressInfo[2];  
                }
            }
            
            
        }
        function search()
        {
            var stationId = document.getElementById("txtStationId").value;
            
            var stationName = document.getElementById("txtStationName").value;
            
            var address = document.getElementById("txtAddress").value; 
            
            var dropProvince = document.getElementById("Province");
            var provinceId="";
            for(var i=0;i<dropProvince.options.length;i++)
            {
                if(dropProvince.options[i].selected==true)
                {
                    provinceId = dropProvince.options[i].value;
                    break;
                }
            }
            var cityId = document.getElementById("hidCityCode").value;
            var areaId = document.getElementById("hidAreaCode").value;
            
            
            var arg = stationId + "$" + stationName + "$" + address + "$" + provinceId + "$" + cityId + "$" + areaId;
                    
            <%= ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "")%>;
        }
        
        function ReceiveServerData(result)  
        {
            document.getElementById("searchResult").innerHTML=result;
        }
    </script>

<style type="text/css">
fieldset {width:96%;}
select {margin:0;padding:0;}
body{padding:0; margin:0; background-color:#ffffff; text-align:center; font: "宋体"; font-size:12px;}
a:visited{text-decoration:none;color:slategray;}
a:hover{text-decoration:underline;color:slategray;}
a:link{text-decoration:none;color:slategray;}
.juli {margin-top:10px;padding-left:20px;}
.juli1 {margin-top:20px; margin-left:20px; text-align:left;}
.juli2 { margin:5px auto;}
.juli3 { margin-bottom:50px;}
.juli4 {padding-left:20px;padding-top:20px;padding-bottom:10px;background-color:#fef3bb;}
.juli5 {padding:0px; margin:0px;}
.z1{background-color:#e7e7e7; text-align:left; line-height:20px;}
.z2{background-color:#FFFFFF; text-align:left; line-height:20px;}
.input_button {width:52px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt.gif) no-repeat;}
.input_button1 {width:74px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt1.gif) no-repeat;}
.input_button2 {width:52px;height:23px;border:none;background:#ffffff url(../Include/Images/bt.gif) no-repeat; padding-top:5px;}
.input_button2 a{color:#000000;}
.input_button2 a:hover{color:#FF3300; text-decoration:underline;}
.input_button3 {width:95px;height:23px;border:none;background:#ffffff url(../Include/Images/bt2.gif) no-repeat;}
.zt1 {padding-left:10px; font-weight:600; color:#000000;}
.zt2 {padding-left:10px;}
.zt3 {text-align:center; font-weight:600; color:#000000;}
.zt4 {text-align:center; color:#000000;}
.zt5 {text-align:left; font-weight:600;}
.zt6 {font-size:14px; font-weight:600;}
.zt7 {text-align:right; color:#000000;}
.zt8 {text-align:right; color:#000000;}
.spmenu { line-height:28px; text-align:center;margin-bottom:10px; border-color:#999999;}
.menu_bg {background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cf994b 1px solid;}
.menu_bg1 { background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-right:20px;border-bottom:#cf994b 1px solid; height:28px;}
.tb {width:530px;background-color:#999999;}
.tb1 {width: 90%; background-color:#999999; margin-top:10px;}
.tb2 {width: 1050px; background-color:#999999;}
.left {float:left; clear:right;}
.k1 {float:left;width:90%; background-color:#efefef; border:#999999 1px solid;padding-top:10px;}
.k2 {float:left; width:90%; line-height:28px; margin-top:10px;}
.k3 {float:left; width:90%; line-height:28px; margin-top:10px; padding-bottom:30px; clear:both;}
.btlj1 {background: url(../Include/Images/bt1.gif) no-repeat; width:74px; height:23px;text-align:center; padding-top:5px; font-size:12px; display:inline; float:left;margin-left:5px;}
.btlj1 a{color:#000000; text-decoration:none;}
.btlj1 a:hover{color:#FF3300;text-decoration:underline;}
.hidden{visibility:hidden;}
a.lj {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:link {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:visited {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:hover {color:#ff3300;}
a.lj:active {color:#ff3300;}
.bk_left {border-bottom:#999999 1px solid;border-right:#999999 1px solid;border-left:#999999 1px solid;border-top:#999999 0px solid;}
.bk_middle {border-bottom:#999999 1px solid;border-right:#999999 1px solid;border-left:#999999 0px solid;border-top:#999999 0px solid;}
h2 {padding-left:20px;padding-top:10px;margin:0; background: url(../Include/Images/menu_title.gif) repeat-x;height:21px;font-size:14px; font-weight:600;}
.menu_bg2 {background-color:#cccccc;text-align:left;margin:10px 0 10px 0;padding-top:5px;padding-bottom:5px;border:#CCCCCC 0px solid; font-size:12px;padding-left:20px;}
.menu_bg3 { background-color:#f5f5f5; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cccccc 1px solid;border-top:#cccccc 1px solid;clear:left;}
</style>    
</head>
<body onload="InitAddress()">
    <form id="form1" runat="server">
        <div>
            <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; height: 413px">
                <tr>
                    <td valign="top" align="left" style="overflow: auto; width: 170px; height: 300px;
                        background-color: #f5f5f5; padding-left: 10px; border-bottom: #cf994b 1px solid;
                        border-right: #cf994b 1px solid;">
                        <br />
                        服务站编号：<asp:TextBox ID="txtStationId" Width="124" runat="server"></asp:TextBox>
                        <br />
                        <br />
                        服务站名称：<asp:TextBox ID="txtStationName" Width="124" runat="server"></asp:TextBox>
                        <br />
                        <br />
                        省：<select id="Province" runat="server" onchange="GetCityList(this.value)" style="width: 96px"></select>
                        <br />
                        <br />
                        市：<select id="City" runat="server" onchange="GetAreaListAndCountTotal(this.value)"
                            style="width: 96px"></select>
                        <br />
                        <br />
                        区：<select id="Area" runat="server" onchange="SetAreaCode()" style="width: 96px"></select>
                        <br />
                        <br />
                        详细地址：<asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
                        <br />
                        <br />
                        
                        <input id="Button3" type="button" class="input_button" value="筛选" onclick="search()" />
                    </td>
                    <td valign="top" align="center" bgcolor="f5f5f5" style="border-bottom: #cf994b 1px solid;
                        width: 711px;">
                        <br />
                        <div id="searchResult" style="width: 539px; height: 348px; overflow: auto;">
                            
                        </div>
                    </td>
                </tr>
            </table>
            <table cellpadding="0" cellspacing="0" border="0" style="width: 750px;">
                <tr>
                    <td valign="top" align="left" class="menu_bg" style="height: 24px">
                        <input id="Button1" type="button" value="确定" class="input_button" onclick="returnf();" />
                        <input id="Button2" type="button" value="取消" class="input_button" onclick="javascript:window.close();" />
                    </td>
                </tr>
            </table>
            <input id="hidCityCode" runat="server" type="hidden" />
            <input id="hidAreaCode" runat="server" type="hidden" />
            <input id="hidCity" type="hidden" runat="server" />
            <input id="hidReceiveAddressInfo" type="hidden" runat="server" />
        </div>
    </form>
</body>
</html>
